package person.bluext.singlegateway.frame.threadlocal;


import person.bluext.singlegateway.frame.model.ReqInfo;

/**
 * Description : Request param holder
 *
 * @author : bluext
 */
public class RequestParamHolder {
    private static final ThreadLocal<ReqInfo> threadLocal = new ThreadLocal<>();

    public static void put(String key, String value) {
        threadLocal.get().put(key, value);
    }

    public static String get(String key) {
        if (threadLocal.get() == null) {
            return null;
        }
        return threadLocal.get().get(key);
    }

    public static void reset() {
        threadLocal.remove();
        threadLocal.set(new ReqInfo());
    }
}
